package b.b.h;

import android.annotation.SuppressLint;
import android.app.SearchableInfo;
import android.content.Context;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
import android.net.Uri;
import android.net.Uri.Builder;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.widget.SearchView;
import b.j.a.c;
import java.io.FileNotFoundException;
import java.util.List;
import java.util.WeakHashMap;

@SuppressLint({"RestrictedAPI"})
/* compiled from: SuggestionsAdapter */
public class z extends c implements OnClickListener {
    public static final /* synthetic */ int y = 0;
    public final SearchView l;
    public final SearchableInfo m;
    public final Context n;
    public final WeakHashMap<String, ConstantState> o;
    public final int p;
    public int q = 1;
    public ColorStateList r;
    public int s = -1;
    public int t = -1;
    public int u = -1;
    public int v = -1;
    public int w = -1;
    public int x = -1;

    /* compiled from: SuggestionsAdapter */
    public static final class a {
        public final TextView a;
        public final TextView b;
        public final ImageView c;
        public final ImageView d;
        public final ImageView e;

        public a(View view) {
            this.a = (TextView) view.findViewById(16908308);
            this.b = (TextView) view.findViewById(16908309);
            this.c = (ImageView) view.findViewById(16908295);
            this.d = (ImageView) view.findViewById(16908296);
            this.e = (ImageView) view.findViewById(2131296534);
        }
    }

    public z(Context context, SearchView searchView, SearchableInfo searchableInfo, WeakHashMap<String, ConstantState> weakHashMap) {
        super(context, searchView.getSuggestionRowLayout(), null, true);
        this.l = searchView;
        this.m = searchableInfo;
        this.p = searchView.getSuggestionCommitIconResId();
        this.n = context;
        this.o = weakHashMap;
    }

    public static String h(Cursor cursor, int i) {
        if (i == -1) {
            return null;
        }
        try {
            return cursor.getString(i);
        } catch (Exception e) {
            Log.e("SuggestionsAdapter", "unexpected error retrieving valid column from cursor, did the remote process die?", e);
            return null;
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:57:0x0147  */
    /* JADX WARNING: Removed duplicated region for block: B:56:0x0145  */
    public void a(android.view.View r18, android.content.Context r19, android.database.Cursor r20) {
        /*
        r17 = this;
        r1 = r17;
        r2 = r20;
        r0 = r18.getTag();
        r3 = r0;
        r3 = (b.b.h.z.a) r3;
        r0 = r1.x;
        r4 = 0;
        r5 = -1;
        if (r0 == r5) goto L_0x0017;
    L_0x0011:
        r0 = r2.getInt(r0);
        r5 = r0;
        goto L_0x0019;
    L_0x0017:
        r0 = 0;
        r5 = 0;
    L_0x0019:
        r0 = r3.a;
        r6 = 8;
        if (r0 == 0) goto L_0x0037;
    L_0x001f:
        r0 = r1.s;
        r0 = h(r2, r0);
        r7 = r3.a;
        r7.setText(r0);
        r0 = android.text.TextUtils.isEmpty(r0);
        if (r0 == 0) goto L_0x0034;
    L_0x0030:
        r7.setVisibility(r6);
        goto L_0x0037;
    L_0x0034:
        r7.setVisibility(r4);
    L_0x0037:
        r0 = r3.b;
        r7 = 2;
        r8 = 1;
        if (r0 == 0) goto L_0x00c0;
    L_0x003d:
        r0 = r1.u;
        r0 = h(r2, r0);
        if (r0 == 0) goto L_0x0087;
    L_0x0045:
        r9 = r1.r;
        if (r9 != 0) goto L_0x0068;
    L_0x0049:
        r9 = new android.util.TypedValue;
        r9.<init>();
        r10 = r1.d;
        r10 = r10.getTheme();
        r11 = 2130969402; // 0x7f04033a float:1.7547485E38 double:1.052838774E-314;
        r10.resolveAttribute(r11, r9, r8);
        r10 = r1.d;
        r10 = r10.getResources();
        r9 = r9.resourceId;
        r9 = r10.getColorStateList(r9);
        r1.r = r9;
    L_0x0068:
        r9 = new android.text.SpannableString;
        r9.<init>(r0);
        r15 = new android.text.style.TextAppearanceSpan;
        r11 = 0;
        r12 = 0;
        r13 = 0;
        r14 = r1.r;
        r16 = 0;
        r10 = r15;
        r6 = r15;
        r15 = r16;
        r10.<init>(r11, r12, r13, r14, r15);
        r0 = r0.length();
        r10 = 33;
        r9.setSpan(r6, r4, r0, r10);
        goto L_0x008d;
    L_0x0087:
        r0 = r1.t;
        r9 = h(r2, r0);
    L_0x008d:
        r0 = android.text.TextUtils.isEmpty(r9);
        if (r0 == 0) goto L_0x00a0;
    L_0x0093:
        r0 = r3.a;
        if (r0 == 0) goto L_0x00ac;
    L_0x0097:
        r0.setSingleLine(r4);
        r0 = r3.a;
        r0.setMaxLines(r7);
        goto L_0x00ac;
    L_0x00a0:
        r0 = r3.a;
        if (r0 == 0) goto L_0x00ac;
    L_0x00a4:
        r0.setSingleLine(r8);
        r0 = r3.a;
        r0.setMaxLines(r8);
    L_0x00ac:
        r0 = r3.b;
        r0.setText(r9);
        r6 = android.text.TextUtils.isEmpty(r9);
        if (r6 == 0) goto L_0x00bd;
    L_0x00b7:
        r6 = 8;
        r0.setVisibility(r6);
        goto L_0x00c0;
    L_0x00bd:
        r0.setVisibility(r4);
    L_0x00c0:
        r6 = r3.c;
        if (r6 == 0) goto L_0x0171;
    L_0x00c4:
        r0 = r1.v;
        r9 = -1;
        if (r0 != r9) goto L_0x00cc;
    L_0x00c9:
        r0 = 0;
        goto L_0x015e;
    L_0x00cc:
        r0 = r2.getString(r0);
        r0 = r1.f(r0);
        if (r0 == 0) goto L_0x00d8;
    L_0x00d6:
        goto L_0x015e;
    L_0x00d8:
        r0 = r1.m;
        r0 = r0.getSearchActivity();
        r9 = r0.flattenToShortString();
        r10 = r1.o;
        r10 = r10.containsKey(r9);
        if (r10 == 0) goto L_0x0101;
    L_0x00ea:
        r0 = r1.o;
        r0 = r0.get(r9);
        r0 = (android.graphics.drawable.Drawable.ConstantState) r0;
        if (r0 != 0) goto L_0x00f6;
    L_0x00f4:
        r0 = 0;
        goto L_0x0151;
    L_0x00f6:
        r9 = r1.n;
        r9 = r9.getResources();
        r0 = r0.newDrawable(r9);
        goto L_0x0151;
    L_0x0101:
        r10 = "SuggestionsAdapter";
        r11 = r1.d;
        r11 = r11.getPackageManager();
        r12 = 128; // 0x80 float:1.794E-43 double:6.32E-322;
        r12 = r11.getActivityInfo(r0, r12);	 Catch:{ NameNotFoundException -> 0x0139 }
        r13 = r12.getIconResource();
        if (r13 != 0) goto L_0x0116;
    L_0x0115:
        goto L_0x0142;
    L_0x0116:
        r14 = r0.getPackageName();
        r12 = r12.applicationInfo;
        r11 = r11.getDrawable(r14, r13, r12);
        if (r11 != 0) goto L_0x0143;
    L_0x0122:
        r11 = "Invalid icon resource ";
        r12 = " for ";
        r11 = c.b.a.a.a.h(r11, r13, r12);
        r0 = r0.flattenToShortString();
        r11.append(r0);
        r0 = r11.toString();
        android.util.Log.w(r10, r0);
        goto L_0x0142;
    L_0x0139:
        r0 = move-exception;
        r11 = r0;
        r0 = r11.toString();
        android.util.Log.w(r10, r0);
    L_0x0142:
        r11 = 0;
    L_0x0143:
        if (r11 != 0) goto L_0x0147;
    L_0x0145:
        r0 = 0;
        goto L_0x014b;
    L_0x0147:
        r0 = r11.getConstantState();
    L_0x014b:
        r10 = r1.o;
        r10.put(r9, r0);
        r0 = r11;
    L_0x0151:
        if (r0 == 0) goto L_0x0154;
    L_0x0153:
        goto L_0x015e;
    L_0x0154:
        r0 = r1.d;
        r0 = r0.getPackageManager();
        r0 = r0.getDefaultActivityIcon();
    L_0x015e:
        r9 = 4;
        r6.setImageDrawable(r0);
        if (r0 != 0) goto L_0x0168;
    L_0x0164:
        r6.setVisibility(r9);
        goto L_0x0171;
    L_0x0168:
        r6.setVisibility(r4);
        r0.setVisible(r4, r4);
        r0.setVisible(r8, r4);
    L_0x0171:
        r0 = r3.d;
        if (r0 == 0) goto L_0x0198;
    L_0x0175:
        r6 = r1.w;
        r9 = -1;
        if (r6 != r9) goto L_0x017c;
    L_0x017a:
        r2 = 0;
        goto L_0x0184;
    L_0x017c:
        r2 = r2.getString(r6);
        r2 = r1.f(r2);
    L_0x0184:
        r0.setImageDrawable(r2);
        if (r2 != 0) goto L_0x018f;
    L_0x0189:
        r6 = 8;
        r0.setVisibility(r6);
        goto L_0x0198;
    L_0x018f:
        r0.setVisibility(r4);
        r2.setVisible(r4, r4);
        r2.setVisible(r8, r4);
    L_0x0198:
        r0 = r1.q;
        if (r0 == r7) goto L_0x01ab;
    L_0x019c:
        if (r0 != r8) goto L_0x01a3;
    L_0x019e:
        r0 = r5 & 1;
        if (r0 == 0) goto L_0x01a3;
    L_0x01a2:
        goto L_0x01ab;
    L_0x01a3:
        r0 = r3.e;
        r2 = 8;
        r0.setVisibility(r2);
        goto L_0x01c0;
    L_0x01ab:
        r0 = r3.e;
        r0.setVisibility(r4);
        r0 = r3.e;
        r2 = r3.a;
        r2 = r2.getText();
        r0.setTag(r2);
        r0 = r3.e;
        r0.setOnClickListener(r1);
    L_0x01c0:
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: b.b.h.z.a(android.view.View, android.content.Context, android.database.Cursor):void");
    }

    public void b(Cursor cursor) {
        try {
            super.b(cursor);
            if (cursor != null) {
                this.s = cursor.getColumnIndex("suggest_text_1");
                this.t = cursor.getColumnIndex("suggest_text_2");
                this.u = cursor.getColumnIndex("suggest_text_2_url");
                this.v = cursor.getColumnIndex("suggest_icon_1");
                this.w = cursor.getColumnIndex("suggest_icon_2");
                this.x = cursor.getColumnIndex("suggest_flags");
            }
        } catch (Exception e) {
            Log.e("SuggestionsAdapter", "error changing cursor and caching columns", e);
        }
    }

    public CharSequence c(Cursor cursor) {
        if (cursor == null) {
            return null;
        }
        String h = h(cursor, cursor.getColumnIndex("suggest_intent_query"));
        if (h != null) {
            return h;
        }
        if (this.m.shouldRewriteQueryFromData()) {
            h = h(cursor, cursor.getColumnIndex("suggest_intent_data"));
            if (h != null) {
                return h;
            }
        }
        if (this.m.shouldRewriteQueryFromText()) {
            String h2 = h(cursor, cursor.getColumnIndex("suggest_text_1"));
            if (h2 != null) {
                return h2;
            }
        }
        return null;
    }

    public View d(Context context, Cursor cursor, ViewGroup viewGroup) {
        View inflate = this.k.inflate(this.i, viewGroup, false);
        inflate.setTag(new a(inflate));
        ((ImageView) inflate.findViewById(2131296534)).setImageResource(this.p);
        return inflate;
    }

    public Drawable e(Uri uri) throws FileNotFoundException {
        String authority = uri.getAuthority();
        StringBuilder stringBuilder;
        if (TextUtils.isEmpty(authority)) {
            stringBuilder = new StringBuilder();
            stringBuilder.append("No authority: ");
            stringBuilder.append(uri);
            throw new FileNotFoundException(stringBuilder.toString());
        }
        try {
            Resources resourcesForApplication = this.d.getPackageManager().getResourcesForApplication(authority);
            List pathSegments = uri.getPathSegments();
            if (pathSegments != null) {
                int parseInt;
                int size = pathSegments.size();
                if (size == 1) {
                    try {
                        parseInt = Integer.parseInt((String) pathSegments.get(0));
                    } catch (NumberFormatException unused) {
                        stringBuilder = new StringBuilder();
                        stringBuilder.append("Single path segment is not a resource ID: ");
                        stringBuilder.append(uri);
                        throw new FileNotFoundException(stringBuilder.toString());
                    }
                } else if (size == 2) {
                    parseInt = resourcesForApplication.getIdentifier((String) pathSegments.get(1), (String) pathSegments.get(0), authority);
                } else {
                    stringBuilder = new StringBuilder();
                    stringBuilder.append("More than two path segments: ");
                    stringBuilder.append(uri);
                    throw new FileNotFoundException(stringBuilder.toString());
                }
                if (parseInt != 0) {
                    return resourcesForApplication.getDrawable(parseInt);
                }
                stringBuilder = new StringBuilder();
                stringBuilder.append("No resource found for: ");
                stringBuilder.append(uri);
                throw new FileNotFoundException(stringBuilder.toString());
            }
            stringBuilder = new StringBuilder();
            stringBuilder.append("No path: ");
            stringBuilder.append(uri);
            throw new FileNotFoundException(stringBuilder.toString());
        } catch (NameNotFoundException unused2) {
            stringBuilder = new StringBuilder();
            stringBuilder.append("No package found for authority: ");
            stringBuilder.append(uri);
            throw new FileNotFoundException(stringBuilder.toString());
        }
    }

    /* JADX WARNING: Missing exception handler attribute for start block: B:34:0x00a1 */
    /* JADX WARNING: Can't wrap try/catch for region: R(3:34|35|36) */
    /* JADX WARNING: Missing block: B:35:?, code skipped:
            r4 = new java.lang.StringBuilder();
            r4.append("Resource does not exist: ");
            r4.append(r2);
     */
    /* JADX WARNING: Missing block: B:36:0x00b7, code skipped:
            throw new java.io.FileNotFoundException(r4.toString());
     */
    public final android.graphics.drawable.Drawable f(java.lang.String r8) {
        /*
        r7 = this;
        r0 = "SuggestionsAdapter";
        r1 = 0;
        if (r8 == 0) goto L_0x013d;
    L_0x0005:
        r2 = r8.isEmpty();
        if (r2 != 0) goto L_0x013d;
    L_0x000b:
        r2 = "0";
        r2 = r2.equals(r8);
        if (r2 == 0) goto L_0x0015;
    L_0x0013:
        goto L_0x013d;
    L_0x0015:
        r2 = java.lang.Integer.parseInt(r8);	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r3 = new java.lang.StringBuilder;	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r3.<init>();	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r4 = "android.resource://";
        r3.append(r4);	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r4 = r7.n;	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r4 = r4.getPackageName();	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r3.append(r4);	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r4 = "/";
        r3.append(r4);	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r3.append(r2);	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r3 = r3.toString();	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r4 = r7.o;	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r4 = r4.get(r3);	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r4 = (android.graphics.drawable.Drawable.ConstantState) r4;	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        if (r4 != 0) goto L_0x0044;
    L_0x0042:
        r4 = r1;
        goto L_0x0048;
    L_0x0044:
        r4 = r4.newDrawable();	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
    L_0x0048:
        if (r4 == 0) goto L_0x004b;
    L_0x004a:
        return r4;
    L_0x004b:
        r4 = r7.n;	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r5 = b.i.c.a.a;	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r2 = r4.getDrawable(r2);	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        if (r2 == 0) goto L_0x005e;
    L_0x0055:
        r4 = r7.o;	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r5 = r2.getConstantState();	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
        r4.put(r3, r5);	 Catch:{ NumberFormatException -> 0x0074, NotFoundException -> 0x005f }
    L_0x005e:
        return r2;
    L_0x005f:
        r2 = new java.lang.StringBuilder;
        r2.<init>();
        r3 = "Icon resource not found: ";
        r2.append(r3);
        r2.append(r8);
        r8 = r2.toString();
        android.util.Log.w(r0, r8);
        return r1;
        r2 = r7.o;
        r2 = r2.get(r8);
        r2 = (android.graphics.drawable.Drawable.ConstantState) r2;
        if (r2 != 0) goto L_0x0081;
    L_0x007f:
        r2 = r1;
        goto L_0x0085;
    L_0x0081:
        r2 = r2.newDrawable();
    L_0x0085:
        if (r2 == 0) goto L_0x0088;
    L_0x0087:
        return r2;
    L_0x0088:
        r2 = android.net.Uri.parse(r8);
        r3 = "Error closing icon stream for ";
        r4 = r2.getScheme();	 Catch:{ FileNotFoundException -> 0x0111 }
        r5 = "android.resource";
        r4 = r5.equals(r4);	 Catch:{ FileNotFoundException -> 0x0111 }
        if (r4 == 0) goto L_0x00b8;
    L_0x009a:
        r0 = r7.e(r2);	 Catch:{ NotFoundException -> 0x00a1 }
        r1 = r0;
        goto L_0x0132;
    L_0x00a1:
        r3 = new java.io.FileNotFoundException;	 Catch:{ FileNotFoundException -> 0x0111 }
        r4 = new java.lang.StringBuilder;	 Catch:{ FileNotFoundException -> 0x0111 }
        r4.<init>();	 Catch:{ FileNotFoundException -> 0x0111 }
        r5 = "Resource does not exist: ";
        r4.append(r5);	 Catch:{ FileNotFoundException -> 0x0111 }
        r4.append(r2);	 Catch:{ FileNotFoundException -> 0x0111 }
        r4 = r4.toString();	 Catch:{ FileNotFoundException -> 0x0111 }
        r3.<init>(r4);	 Catch:{ FileNotFoundException -> 0x0111 }
        throw r3;	 Catch:{ FileNotFoundException -> 0x0111 }
    L_0x00b8:
        r4 = r7.n;	 Catch:{ FileNotFoundException -> 0x0111 }
        r4 = r4.getContentResolver();	 Catch:{ FileNotFoundException -> 0x0111 }
        r4 = r4.openInputStream(r2);	 Catch:{ FileNotFoundException -> 0x0111 }
        if (r4 == 0) goto L_0x00fa;
    L_0x00c4:
        r5 = android.graphics.drawable.Drawable.createFromStream(r4, r1);	 Catch:{ all -> 0x00e1 }
        r4.close();	 Catch:{ IOException -> 0x00cc }
        goto L_0x00df;
    L_0x00cc:
        r4 = move-exception;
        r6 = new java.lang.StringBuilder;	 Catch:{ FileNotFoundException -> 0x0111 }
        r6.<init>();	 Catch:{ FileNotFoundException -> 0x0111 }
        r6.append(r3);	 Catch:{ FileNotFoundException -> 0x0111 }
        r6.append(r2);	 Catch:{ FileNotFoundException -> 0x0111 }
        r3 = r6.toString();	 Catch:{ FileNotFoundException -> 0x0111 }
        android.util.Log.e(r0, r3, r4);	 Catch:{ FileNotFoundException -> 0x0111 }
    L_0x00df:
        r1 = r5;
        goto L_0x0132;
    L_0x00e1:
        r5 = move-exception;
        r4.close();	 Catch:{ IOException -> 0x00e6 }
        goto L_0x00f9;
    L_0x00e6:
        r4 = move-exception;
        r6 = new java.lang.StringBuilder;	 Catch:{ FileNotFoundException -> 0x0111 }
        r6.<init>();	 Catch:{ FileNotFoundException -> 0x0111 }
        r6.append(r3);	 Catch:{ FileNotFoundException -> 0x0111 }
        r6.append(r2);	 Catch:{ FileNotFoundException -> 0x0111 }
        r3 = r6.toString();	 Catch:{ FileNotFoundException -> 0x0111 }
        android.util.Log.e(r0, r3, r4);	 Catch:{ FileNotFoundException -> 0x0111 }
    L_0x00f9:
        throw r5;	 Catch:{ FileNotFoundException -> 0x0111 }
    L_0x00fa:
        r3 = new java.io.FileNotFoundException;	 Catch:{ FileNotFoundException -> 0x0111 }
        r4 = new java.lang.StringBuilder;	 Catch:{ FileNotFoundException -> 0x0111 }
        r4.<init>();	 Catch:{ FileNotFoundException -> 0x0111 }
        r5 = "Failed to open ";
        r4.append(r5);	 Catch:{ FileNotFoundException -> 0x0111 }
        r4.append(r2);	 Catch:{ FileNotFoundException -> 0x0111 }
        r4 = r4.toString();	 Catch:{ FileNotFoundException -> 0x0111 }
        r3.<init>(r4);	 Catch:{ FileNotFoundException -> 0x0111 }
        throw r3;	 Catch:{ FileNotFoundException -> 0x0111 }
    L_0x0111:
        r3 = move-exception;
        r4 = new java.lang.StringBuilder;
        r4.<init>();
        r5 = "Icon not found: ";
        r4.append(r5);
        r4.append(r2);
        r2 = ", ";
        r4.append(r2);
        r2 = r3.getMessage();
        r4.append(r2);
        r2 = r4.toString();
        android.util.Log.w(r0, r2);
    L_0x0132:
        if (r1 == 0) goto L_0x013d;
    L_0x0134:
        r0 = r7.o;
        r2 = r1.getConstantState();
        r0.put(r8, r2);
    L_0x013d:
        return r1;
        */
        throw new UnsupportedOperationException("Method not decompiled: b.b.h.z.f(java.lang.String):android.graphics.drawable.Drawable");
    }

    public Cursor g(SearchableInfo searchableInfo, String str, int i) {
        Cursor cursor = null;
        if (searchableInfo == null) {
            return null;
        }
        String suggestAuthority = searchableInfo.getSuggestAuthority();
        if (suggestAuthority == null) {
            return null;
        }
        Builder authority = new Builder().scheme("content").authority(suggestAuthority);
        String str2 = "";
        authority = authority.query(str2).fragment(str2);
        str2 = searchableInfo.getSuggestPath();
        if (str2 != null) {
            authority.appendEncodedPath(str2);
        }
        authority.appendPath("search_suggest_query");
        String suggestSelection = searchableInfo.getSuggestSelection();
        if (suggestSelection != null) {
            cursor = new String[]{str};
        } else {
            authority.appendPath(str);
        }
        String[] strArr = cursor;
        if (i > 0) {
            authority.appendQueryParameter("limit", String.valueOf(i));
        }
        return this.d.getContentResolver().query(authority.build(), null, suggestSelection, strArr, null);
    }

    public View getDropDownView(int i, View view, ViewGroup viewGroup) {
        try {
            return super.getDropDownView(i, view, viewGroup);
        } catch (RuntimeException e) {
            Log.w("SuggestionsAdapter", "Search suggestions cursor threw exception.", e);
            view = this.k.inflate(this.j, viewGroup, false);
            if (view != null) {
                ((a) view.getTag()).a.setText(e.toString());
            }
            return view;
        }
    }

    public View getView(int i, View view, ViewGroup viewGroup) {
        try {
            return super.getView(i, view, viewGroup);
        } catch (RuntimeException e) {
            Log.w("SuggestionsAdapter", "Search suggestions cursor threw exception.", e);
            view = d(this.d, this.c, viewGroup);
            ((a) view.getTag()).a.setText(e.toString());
            return view;
        }
    }

    public boolean hasStableIds() {
        return false;
    }

    public final void i(Cursor cursor) {
        Bundle extras = cursor != null ? cursor.getExtras() : null;
        if (extras == null || extras.getBoolean("in_progress")) {
        }
    }

    public void notifyDataSetChanged() {
        super.notifyDataSetChanged();
        i(this.c);
    }

    public void notifyDataSetInvalidated() {
        super.notifyDataSetInvalidated();
        i(this.c);
    }

    public void onClick(View view) {
        Object tag = view.getTag();
        if (tag instanceof CharSequence) {
            this.l.x((CharSequence) tag);
        }
    }
}
